<?php


namespace App\Http\Controllers\Api;


use App\Http\Requests\ApiRequest;

class BaseController
{
    public function success($data = [],$code =200)
    {
        return response()->json([
            'status'  => true,
            'code'    => $code,
            'message' => config('errorcode.code')[$code],
            'data'    => $data,
        ]);
    }

    public function fail($code, $data = [])
    {
        return response()->json([
            'status'  => false,
            'code'    => $code,
            'message' => config('errorcode.code')[(int) $code],
            'data'    => $data,
        ]);
    }
}
